import Types from '../actionTypes';

let initState = {
  groupTreeOne: [],
  sopplierData: [],
  logisticsTemplate: [],
  specChangeData: [],
  braftEditorContent: '',
  editGoodData: {}
};

export default (state = initState, action) => {
  const newState = JSON.parse(JSON.stringify(state));
  switch (action.type) {
    case Types.GET_FROUP_NO_TREE:
      newState.groupTreeOne = action.data;
      return newState;
    case Types.GET_SOPPLIER_DATA:
      newState.sopplierData = action.data;
      return newState;
    case Types.GET_LOGISTICS_TEMPLATE:
      newState.logisticsTemplate = action.data;
      return newState;
    case Types.GET_SPEC_CHANGE_DATA:
      newState.specChangeData = action.data;
      return newState;
    case Types.BRAFT_EDITOR_CONTENT:
      newState.braftEditorContent = action.content;
      return newState;
    case Types.EDIT_GOOD_DATA:
      newState.editGoodData = action.data;
      return newState;
    default:
      console.log('Types no match in generatingGoods.js ....');
  }
  return state;
}
